<script setup lang='ts'>
import {useLang} from "@/hooks/useLang"


const {lang,setLang,t}=useLang()

function handleSelect(c:any){
  //console.log(c)
  if(c!=lang.value) {
    setLang(c)
    console.log("使用i18n配置的语言",c,t("global.toggle"))
  }
}
</script>

<template>
 <el-dropdown @command="handleSelect">
    <span class="el-dropdown-link" :style="{color:'white',cursor:'pointer',outline:'none',userSelect:'none'}">
      <!-- 切换语言
      <el-icon class="el-icon--right">
        <arrow-down />
      </el-icon> -->
      <my-icon  name="global" width="22px" height="22px" />
    </span>
    <template #dropdown>
      <el-dropdown-menu >
        <el-dropdown-item command="zh">中文</el-dropdown-item>
        <el-dropdown-item command="en">英文</el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>

<style scoped>

</style>